module employee;

import <iostream>;
import <format>;

namespace Records
{
	Employee::Employee(const std::string &firstName, const std::string &lastName)
		: m_firstName{ firstName },
		m_lastName{ lastName }
	{
	}

	void Employee::promote(int raiseAmount)
	{
		setSalary(getSalary() + raiseAmount);
	}

	void Employee::demote(int demeritAmount)
	{
		setSalary(getSalary() - demeritAmount);
	}

	void Employee::hire() // Hires of rehires the employee
	{
		m_hired = true;
	}

	void Employee::fire() // Dismisses the employee
	{
		m_hired = false;
	}

	void Employee::display() const // Outputs employee info to console
	{
		std::cout << std::format("Employee: {}, {}\n", getFirstName(), getLastName()) << std::endl;
		std::cout << "-------------------------" << std::endl;
		std::cout << (isHired() ? "Current Employee" : "Former Employee") << std::endl;
		std::cout << std::format("Employee Number: {}", getEmployeeNumber()) << std::endl;
		std::cout << std::format("Salary: ${}", getSalary()) << std::endl;
		std::cout << std::endl;
	}

	// Getters and setters
	void Employee::setFirstName(const std::string &firstName)
	{
		m_firstName = firstName;
	}

	auto Employee::getFirstName() const->const std::string &
	{
		return m_firstName;
	}

	void Employee::setLastName(const std::string &lastName)
	{
		m_lastName = lastName;
	}

	auto Employee::getLastName() const->const std::string &
	{
		return m_lastName;
	}

	void Employee::setEmployeeNumber(int employeeNumber)
	{
		m_employeeNumber = employeeNumber;
	}

	auto Employee::getEmployeeNumber() const->int
	{
		return m_employeeNumber;
	}

	void Employee::setSalary(int salary)
	{
		m_salary = salary;
	}

	auto Employee::getSalary() const->int
	{
		return m_salary;
	}

	bool Employee::isHired() const
	{
		return m_hired;
	}
}